
<div id="">
	
<h1>订单列表</h1>
<%= link_to '添加订单', new_order_path, :class => "btn btn-default" %>

<table class="table table-hover table-sm table-responsive">
	<thead>
		<tr>
			<th>日期</th>
			<th>订单编号</th>
			<th>客户</th>
			<th>客户ERP</th>
			<th>客户订单日期</th>
			<th>产品规格</th>
			<th>金额</th>
			<th>交期</th>
			<th>备注</th>
			<th></th>			
		</tr>
	</thead>

	<tbody>
		<% @orders.each do |order| %>
		<tr>
			<td><%= order.created_at.strftime("%Y-%m-%d") %></td>
			<td><%= order.order_code %></td>
			<td><%= order.customer.name %></td>
			<td><%= order.customer_po %></td>
			<td><%= order.po_date %></td>
			<td>
			<table>

				<% order.items.each do |item| %>
				<tr>
					<td><%= item.product %> </td>
					<td><%= item.quantity %></td>
					<td><%= item.price %></td>
				</tr>
				<% end %>

			</table></td>
			<td><%= order.amount %></td>
			<td><%= order.due_date %></td>
			<td><%= order.comment %></td>
			<td><%= link_to image_tag('show.png'), order %>
				<%= link_to image_tag('edit.gif'), edit_order_path(order) %>
				<%= link_to image_tag('trash.gif'), order, method: :delete, data: { confirm: 'Are you sure?' } %></td>
		</tr>
		<% end %>
	</tbody>
</table>

<br>


<br />
</div>
